package com.itheima.个人代码.IO流2;

import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;

public class Demo7 {
    public static void main(String[] args) throws IOException {
        account1();
        //account2();

    }

    public static void account2() throws IOException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名:");
        String username = sc.next();
        System.out.println("请输入密码:");
        String password = sc.next();
        FileWriter fw = new FileWriter("IO流2和对象操作流properties\\account.txt");
        fw.write(username);
        fw.write(System.lineSeparator());
        fw.write(password);
        fw.write(System.lineSeparator());
        fw.flush();
        fw.close();
    }

    public static void account1() throws IOException {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户名:");
        String username = sc.next();
        System.out.println("请输入密码:");
        username = username + "=" + sc.next();
        FileWriter fw = new FileWriter("IO流2和对象操作流properties\\account.txt");
        fw.write(username);
        fw.write(System.lineSeparator());
        fw.flush();
        fw.close();
    }
}
